package common.view;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.JSeparator;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Color;
import java.awt.Dimension;

public class MaterialAdderView extends JPanel
{
	private JComboBox cbMaterialName;
	private JTextField tfAmount;
	private JButton btnAdd;
	private JComboBox cbMaterialSpecification;
	
	public MaterialAdderView() 
	{
		setPreferredSize(new Dimension(180, 220));
		setBackground(Color.GRAY);
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel labelMaterial = new JLabel("Select Material Name", SwingConstants.LEADING);
		labelMaterial.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, labelMaterial, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, labelMaterial, 10, SpringLayout.WEST, this);
		add(labelMaterial);
		
		cbMaterialName = new JComboBox();
		cbMaterialName.setPreferredSize(new Dimension(30, 20));
		springLayout.putConstraint(SpringLayout.NORTH, cbMaterialName, 6, SpringLayout.SOUTH, labelMaterial);
		springLayout.putConstraint(SpringLayout.WEST, cbMaterialName, 10, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.EAST, cbMaterialName, -10, SpringLayout.EAST, this);
		add(cbMaterialName);
		
		JLabel labelSpec = new JLabel("Select Specification", SwingConstants.LEADING);
		springLayout.putConstraint(SpringLayout.NORTH, labelSpec, 10, SpringLayout.SOUTH, cbMaterialName);
		labelSpec.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.WEST, labelSpec, 0, SpringLayout.WEST, labelMaterial);
		add(labelSpec);
		
		cbMaterialSpecification = new JComboBox();
		cbMaterialSpecification.setMinimumSize(new Dimension(30, 20));
		springLayout.putConstraint(SpringLayout.NORTH,cbMaterialSpecification, 6, SpringLayout.SOUTH, labelSpec);
		springLayout.putConstraint(SpringLayout.WEST, cbMaterialSpecification, 10, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.EAST, cbMaterialSpecification, -10, SpringLayout.EAST, this);
		add(cbMaterialSpecification);
		
		JLabel lblAmount = new JLabel("Amount");
		lblAmount.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblAmount, 10, SpringLayout.SOUTH, cbMaterialSpecification);
		springLayout.putConstraint(SpringLayout.WEST, lblAmount, 10, SpringLayout.WEST,this);
		add(lblAmount);
		
		tfAmount = new JTextField();
		tfAmount.setPreferredSize(new Dimension(30, 20));
		tfAmount.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tfAmount, 6, SpringLayout.SOUTH, lblAmount);
		springLayout.putConstraint(SpringLayout.WEST, tfAmount, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, tfAmount, -10, SpringLayout.EAST, this);
		add(tfAmount);
		tfAmount.setColumns(10);
		
		btnAdd = new JButton("Add");
		btnAdd.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnAdd, 20, SpringLayout.SOUTH, tfAmount);
		springLayout.putConstraint(SpringLayout.WEST, btnAdd, 10, SpringLayout.WEST,this);
		add(btnAdd);
		btnAdd.setActionCommand("mAdderAdd");
		
	}

	public JComboBox getCbMaterialName() {
		return cbMaterialName;
	}

	public void setCbMaterialName(JComboBox cbMaterialName) {
		this.cbMaterialName = cbMaterialName;
	}

	public JTextField getTfAmount() {
		return tfAmount;
	}

	public void setTfAmount(JTextField tfAmount) {
		this.tfAmount = tfAmount;
	}

	public JButton getBtnAdd() {
		return btnAdd;
	}

	public void setBtnAdd(JButton btnAdd) {
		this.btnAdd = btnAdd;
	}

	public JComboBox getCbMaterialSpecification() {
		return cbMaterialSpecification;
	}

	public void setCbMaterialSpecification(JComboBox cbMaterialSpecification) {
		this.cbMaterialSpecification = cbMaterialSpecification;
	}
	
}
